StartSimulationEngine

//Set Light

AddLightSourceEntity  initsun1
	/LightType:Directional
	/Direction:1.0  -1.0  -1.0

AddLightSourceEntity  initsun2
	/LightType:Directional
	/Direction:0  -1.0  0

AddLightSourceEntity  initsun3
	/LightType:Directional
	/Direction:0  1.0  0

UpdateCameraView
	/EyePosition:1  1  1  	/LookAtPoint:0  0  0


//Define Satelliet Entity

AddNewEntity  body  	/Position:0  0  0
	/Mesh:"Satellite.obj"
	/IgnoreGravity:true

AddBoxShape
	/Dimensions:0.02  0.4  0.2  	/Mass:0.1
	/Position:0.1    0    0
	/MaterialProperties:1    0    0   //Restitution, DynamicFriction, StaticFriction

AddBoxShape
	/Dimensions:0.02  0.4  0.2  	/Mass:0.1
	/Position:-0.1    0    0
	/MaterialProperties:1    0    0   //Restitution, DynamicFriction, StaticFriction

AddBoxShape
	/Dimensions:0.2  0.4  0.02  	/Mass:0.1
	/Position:0    0    0.1
	/MaterialProperties:1    0    0   //Restitution, DynamicFriction, StaticFriction

AddBoxShape
	/Dimensions:0.2  0.4  0.02  	/Mass:0.1
	/Position:0    0    -0.1
	/MaterialProperties:1    0    0   //Restitution, DynamicFriction, StaticFriction

AddBoxShape
	/Dimensions:0.65  0.01  0.25  	/Mass:0.1
	/Position:-0.45    0    0
	/MaterialProperties:1    0    0   //Restitution, DynamicFriction, StaticFriction

AddBoxShape
	/Dimensions:0.65  0.01  0.25  	/Mass:0.1
	/Position:0.45    0    0
	/MaterialProperties:1    0    0   //Restitution, DynamicFriction, StaticFriction


AddCustomSpriteEntity    sprite1
	/ParentEntity:body
	/Position:0  -0.2  0
	/SpritePivotType:Fixed
	/Width:0.1
	/Height:0.2
	/Texture:"Glow.jpg"

AddCustomSpriteEntity    sprite2
	/ParentEntity:body
	/Position:0  -0.2  0
	/Orientation:0    90    0
	/SpritePivotType:Fixed
	/Width:0.1
	/Height:0.2
	/Texture:"Glow.jpg"


//Define reactors of Y axis

AddNewEntity  reactorY1  	/Position:0  0.05  0
	/IgnoreGravity:true
	/ParentEntity:body

AddBoxShape
	/Dimensions:0.04  0.04  0.04  	/Mass:0.1

AddNewEntity  reactorY2  	/Position:0  -0.05  0
	/IgnoreGravity:true
	/ParentEntity:body

AddBoxShape
	/Dimensions:0.04  0.04  0.04  	/Mass:0.1


//Define reactors of X axis

AddNewEntity  reactorX1  	/Position:0.05  0  0
	/IgnoreGravity:true
	/ParentEntity:body

AddBoxShape
	/Dimensions:0.04  0.04  0.04  	/Mass:0.1

AddNewEntity  reactorX2  	/Position:-0.05  0   0
	/IgnoreGravity:true
	/ParentEntity:body

AddBoxShape
	/Dimensions:0.04  0.04  0.04  	/Mass:0.1


//Define reactors of Z axis

AddNewEntity  reactorZ1  	/Position:0  0  0.05
	/IgnoreGravity:true
	/ParentEntity:body

AddBoxShape
	/Dimensions:0.04  0.04  0.04  	/Mass:0.1

AddNewEntity  reactorZ2  	/Position:0   0  -0.05
	/IgnoreGravity:true
	/ParentEntity:body

AddBoxShape
	/Dimensions:0.04  0.04  0.04  	/Mass:0.1


//Connect  reactors with joint

AddJoint  joint_y1
	/ChildEntity:reactorY1
	/JointPosition:0  0  0
	/YAngular:velocity  500000  100000  0  1000000

AddJoint  joint_y2
	/ChildEntity:reactorY2
	/JointPosition:0  0  0
	/YAngular:velocity  500000  100000  0  1000000

AddJoint  joint_x1
	/ChildEntity:reactorX1
	/JointPosition:0  0  0
	/XAngular:velocity  500000  100000  0  1000000

AddJoint  joint_x2
	/ChildEntity:reactorX2
	/JointPosition:0  0  0
	/XAngular:velocity  500000  100000  0  1000000


AddJoint  joint_z1
	/ChildEntity:reactorZ1
	/JointPosition:0  0  0
	/ZAngular:velocity  500000  100000  0  1000000

AddJoint  joint_z2
	/ChildEntity:reactorZ2
	/JointPosition:0  0  0
	/ZAngular:velocity  500000  100000  0  1000000


FlushScript  

Call  proc1


Procedure  proc1 


	reactorY1.JointVelocity(0,  10,  0)
	
	reactorY2.JointVelocity(0,  10,  0)

	//wait 5 seconds
	Wait  	5000
	
	reactorY1.JointVelocity(0,  0,  0)
	
	reactorY2.JointVelocity(0,  0,  0)

	reactorX1.JointVelocity(10,  0,  0)
	
	reactorX2.JointVelocity(10,  0,  0)

	//wait 5 seconds
	Wait  	5000	

	reactorX1.JointVelocity(0,  0,  0)
	
	reactorX2.JointVelocity(0,  0,  0)

	reactorZ1.JointVelocity(0,  0,  10)
	
	reactorZ2.JointVelocity(0,  0,  10)


	//wait 5 seconds
	Wait  	5000	

	reactorZ1.JointVelocity(0,  0,  0)
	
	reactorZ2.JointVelocity(0,  0,  0)

	body.KeepForceAt(0, 0.5, 0, true, 0, -0.2, 0, true)

End

